import type { PlansConditionVO } from "@/api/follow";
import { defineStore } from "pinia";

interface DictData {
  riskLevelList?: any[];
  healthCategoryList?: any[];
  statusList?: any[];
  medicalInstitutionList?: any[];
  healthTagList?: any[];
  followUpPlanCondition?: PlansConditionVO; // 随访计划条件数据
  [key: string]: any;
}

interface ToolsState {
  dictData: DictData;
}

export const useToolsStore = defineStore("tools", {
  state: (): ToolsState => ({
    dictData: {}
  }),

  actions: {
    // 设置字典数据
    setDictData(data: DictData) {
      this.dictData = data;
      // 添加日志，便于调试
      console.log("字典数据已更新:", this.dictData);
    },

    // 获取字典数据
    getDictData(): DictData {
      return this.dictData;
    },

    // 清空字典数据
    clearDictData() {
      this.dictData = {};
    }
  }
});
